import java.text.Bidi;
import java.util.*;
public class nk1602 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int n1=sc.nextInt();
        String s= sc.next();
        String bidui = sc.next();
        StringBuffer sb = new StringBuffer();
        for(int i=0;i<n;i++){
            if(s.charAt(i)>='a'&&s.charAt(i)<='z'){
                sb.append(s.charAt(i));
            }
        }
        String end=sb.toString();
        int n2=end.indexOf(bidui);
        if(n2>=0){
            System.out.println("YES");
        }else System.out.println("NO");
    }
}
